package com.jxc.action;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;

import com.jxc.model.vo.SessionInfo;
import com.jxc.util.ResourceUtil;

@Namespace("/")
public class IndexAction extends BaseAction {

	@Action(value = "index", results = { @Result(name = "index", location = "/demo/index.jsp"),
			@Result(name = "login", location = "/login.jsp") })
	public String index() {
		SessionInfo sessionInfo = (SessionInfo) ServletActionContext.getRequest().getSession().getAttribute(ResourceUtil.getSessionInfoName());
		if (sessionInfo == null) {
			return "login";
		}
		return "index";
	}

}
